package com.example.fm;

import org.openqa.selenium.By;

import com.example.tests.ContactData;

public class ContactHelper extends HelperBase {

	public ContactHelper(ApplicationManager manager) {
		super(manager);
		
	}

	public void submitNewContactCreation() {
		click(By.name("submit"));
	}

	public void fillContactData(ContactData contact) {
		type(By.name("firstname"),contact.firstname);
		type(By.name("lastname"),contact.lastname);
		type(By.name("address"),contact.address);
		type(By.name("mobile"),contact.mobile);
		type(By.name("work"),contact.work);
		type(By.name("email"),contact.email);
		type(By.name("email2"),contact.email2);
		type(By.name("home"),contact.home);
		selectByText(By.name("bday"), contact.bday);
		selectByText(By.name("bmonth"), contact.bmonth);
		type(By.name("byear"),contact.byear);
		selectByText(By.name("new_group"), contact.group);
		type(By.name("address2"),contact.address2);
		type(By.name("phone2"),contact.phone2);
	}

	public void initContactModifications() {
		click(By.xpath("//tr[2]/td/input[@type='checkbox']"));
		click(By.xpath("//tr[2]//a//img[@alt='Edit']"));
		
	}

	public void submitContactDelete() {
		click(By.xpath("//input[@value='Delete']"));
		
	}

	public void submitContactModification() {
		click(By.xpath("//input[@value='Update']"));
		
	}

	
}
